package cn.com.xiaoyaoji.utils;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class DSFInterface {

    private String requestMethod;

    private String dataType;

    private String description;

    private String contentType;

    private String lastModifyInfo;

    private List<CXUArg> requestArgs = new ArrayList<>();

    private List<CXUArg> requestHeaders = new ArrayList<>();

    private List<CXUArg> responseArgs = new ArrayList<>();

    private List<CXUArg> responseHeaders = new ArrayList<>();

    private String url;

    private String status;

    public String getRequestMethod() {
        return requestMethod;
    }

    public String getDataType() {
        return dataType;
    }

    public String getDescription() {
        return description;
    }

    public String getContentType() {
        return contentType;
    }

    public String getLastModifyInfo() {
        return lastModifyInfo;
    }

    public List<CXUArg> getRequestArgs() {
        return requestArgs;
    }

    public List<CXUArg> getRequestHeaders() {
        return requestHeaders;
    }

    public List<CXUArg> getResponseArgs() {
        return responseArgs;
    }

    public List<CXUArg> getResponseHeaders() {
        return responseHeaders;
    }

    public String getUrl() {
        return url;
    }

    public String getStatus() {
        return status;
    }

    public void setRequestMethod(String requestMethod) {
        this.requestMethod = requestMethod;
    }

    public void setDataType(String dataType) {
        this.dataType = dataType;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public void setLastModifyInfo(String lastModifyInfo) {
        this.lastModifyInfo = lastModifyInfo;
    }

    public void setRequestArgs(List<CXUArg> requestArgs) {
        this.requestArgs = requestArgs;
    }

    public void setRequestHeaders(List<CXUArg> requestHeaders) {
        this.requestHeaders = requestHeaders;
    }

    public void setResponseArgs(List<CXUArg> responseArgs) {
        this.responseArgs = responseArgs;
    }

    public void setResponseHeaders(List<CXUArg> responseHeaders) {
        this.responseHeaders = responseHeaders;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @SuppressWarnings("unchecked")
    public static DSFInterface builder(File file,String modelName) throws InstantiationException, IllegalAccessException {
        Class<DSFInterface> inter = DSFInterface.class;
        DSFInterface dsfInter = null;

        dsfInter = inter.newInstance();
        dsfInter.setRequestMethod("POST");
        dsfInter.setDataType("X-WWW-FORM-URLENCODED");
        dsfInter.setDescription("");
        dsfInter.setLastModifyInfo(null);
        dsfInter.setContentType("JSON");
        dsfInter.setRequestArgs(CXUArg.dsfbuilder(file,modelName));
        dsfInter.setResponseArgs(null);
        dsfInter.setResponseHeaders(null);
        dsfInter.setUrl("$ctx$/dsfcallweb/processDsfcall.html");
        dsfInter.setStatus("有效");

        return dsfInter;
    }
}
